summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-09-26 19:27:28 +0200
committerCharles Lombardo <clombardo169@gmail.com>2023-09-26 19:27:28 +0200
commit95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9 (patch)
tree74247b02a0dfe1c102ee704cb2cf1d306730b375
parentandroid: Refactor zip code into FileUtil (diff)
downloadyuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.tar
yuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.tar.gz
yuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.tar.bz2
yuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.tar.lz
yuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.tar.xz
yuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.tar.zst
yuzu-95a31b8887c2cfdf6f0ff0beb0bbf9f5c47b81f9.zip
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt
index 0d16a7d37..f128deda8 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/IndeterminateProgressDialogFragment.kt
@@ -4,12 +4,12 @@
package org.yuzu.yuzu_emu.fragments
import android.app.Dialog
-import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
+import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.activityViewModels
@@ -39,9 +39,7 @@ class IndeterminateProgressDialogFragment : DialogFragment() {
.setView(binding.root)
if (cancellable) {
- dialog.setNegativeButton(android.R.string.cancel) { _: DialogInterface, _: Int ->
- taskViewModel.setCancelled(true)
- }
+ dialog.setNegativeButton(android.R.string.cancel, null)
}
val alertDialog = dialog.create()
@@ -98,6 +96,18 @@ class IndeterminateProgressDialogFragment : DialogFragment() {
}
}
+ // By default, the ProgressDialog will immediately dismiss itself upon a button being pressed.
+ // Setting the OnClickListener again after the dialog is shown overrides this behavior.
+ override fun onResume() {
+ super.onResume()
+ val alertDialog = dialog as AlertDialog
+ val negativeButton = alertDialog.getButton(Dialog.BUTTON_NEGATIVE)
+ negativeButton.setOnClickListener {
+ alertDialog.setTitle(getString(R.string.cancelling))
+ taskViewModel.setCancelled(true)
+ }
+ }
+
companion object {
const val TAG = "IndeterminateProgressDialogFragment"